﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data.SqlClient;
using System.Data;

namespace ACNetMusic
{
    class ClientDAO : DataProvider
    {
        public ArrayList getClientsList()
        {
            connect();
            string sql = "SELECT * FROM Clients";
            adapter = new SqlDataAdapter(sql, connection);
            DataSet dataset = new DataSet();
            adapter.Fill(dataset);
            ArrayList arr = ConverDataSetToArrayList(dataset);
            return arr;
        }

        protected override object GetDataFromDataRow(DataTable dt, int i)
        {
            ClientDTO info = new ClientDTO();
            info.Ip = dt.Rows[i]["IP"].ToString();
            info.SharePort = dt.Rows[i]["Port"].ToString();
            return (object)info;
        }
    }
}
